//
//  YWDataSouce.h
//  YWBaseFrameWork
//
//  Created by NeiQuan on 16/7/19.
//  Copyright © 2016年 NeiQuan. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@protocol YWDataSourceDelegate <NSObject>

@optional

- (void)tableView:(UITableView *)tableView deleteRowAtIndexPath:(NSIndexPath *)indexPath;

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath;

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;


#pragma mark ============= scroll delegate =============
- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView;
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset NS_AVAILABLE_IOS(5_0);
// called on finger up if the user dragged. decelerate is true if it will continue moving afterwards
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;

- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;   // called on finger up as we are moving
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;      // called when scroll view grinds to a halt

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView;
@end

@interface YWDataSouce : NSObject<UITableViewDelegate,UITableViewDataSource>

// 传入的数据
@property (nonatomic, assign) BOOL hasMore;
//经过处理的数据.
@property (nonatomic, retain) NSMutableArray  *cellDataArray;
@property (nonatomic, weak) id<YWDataSourceDelegate> delegate;
@property (nonatomic, weak) UITableView         *tableView;
- (void)updateFirstPageDataArray:(NSArray *)dataArray;

/*
 * 在table最后插入cell 并有插入动画
 */
- (void)updateMorePageDataArray:(NSArray *)dataArray;

/*
 * 更新tableview中指定行的数据，并且可以带动画
 */
- (void)updateDataAtIndexPaths:(NSArray *)indexs withDataArray:(NSArray *)dataArray;



@end
